from hero import Jinx, Timo
# def get_yaml_data(yaml_file):
#     file = open(yaml_file, 'r', encoding='utf-8')
class HeroFactory():
    def create_factory(self, classname):
        if classname == 'Jinx':
            return  Jinx()
        elif classname == 'Timo':
            return Timo()
        else:
            raise Exception('调用未定义类');

hero_factory = HeroFactory();
Jinx = hero_factory.create_factory('Jinx')
Timo = hero_factory.create_factory('Timo')

print(Jinx.fight(1000, 800))
print(Timo.fight(1200, 500))
